<template>
	<router-view></router-view>
	<transition name="van-fade">
		<div
			v-if="showReturnBtn"
			class="return_icon"
			@click.stop.prevent="clickReturn"
		>
			<van-icon class="return_icon__inner" name="share-o" />
		</div>
	</transition>
</template>

<script setup>
import api from './http/api'
import constant from "./utils/constant";
import md5 from 'js-md5'
import { useStore } from 'vuex'
import { useRouter, useRoute } from 'vue-router'
import { provide, computed, onMounted } from 'vue'

provide('api', api)
provide('md5', md5)
provide('constant', constant)

const route = useRoute()
const router = useRouter()
const store = useStore()

const showReturnBtn = computed(() => {
	return !!route.meta.returnAction
})

const clickReturn = () => router.go(-1)

onMounted(() => {
  store.dispatch('tenant/hasConfig')
})
</script>
